.class Lcom/facebook/orca/protocol/SendMessageMethod;
.super Ljava/lang/Object;
.source "SendMessageMethod.java"

# interfaces
.implements Lcom/facebook/orca/protocol/ApiMethod;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lcom/facebook/orca/protocol/ApiMethod",
        "<",
        "Lcom/facebook/orca/server/OutgoingMessage;",
        "Ljava/lang/String;",
        ">;"
    }
.end annotation


# instance fields
.field private final a:Lcom/facebook/orca/protocol/SendMessageParameterHelper;


# direct methods
.method public constructor <init>(Lcom/facebook/orca/protocol/SendMessageParameterHelper;)V
    .locals 0
    .parameter
    .annotation runtime Lcom/google/inject/Inject;
    .end annotation

    .prologue
    .line 27
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 28
    iput-object p1, p0, Lcom/facebook/orca/protocol/SendMessageMethod;->a:Lcom/facebook/orca/protocol/SendMessageParameterHelper;

    .line 29
    return-void
.end method


# virtual methods
.method public a(Lcom/facebook/orca/server/OutgoingMessage;)Lcom/facebook/orca/protocol/ApiRequest;
    .locals 6
    .parameter

    .prologue
    .line 33
    invoke-static {}, Lcom/google/common/collect/Lists;->a()Ljava/util/ArrayList;

    move-result-object v4

    .line 35
    new-instance v0, Lorg/apache/http/message/BasicNameValuePair;

    const-string v1, "id"

    invoke-virtual {p1}, Lcom/facebook/orca/server/OutgoingMessage;->a()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v0, v1, v2}, Lorg/apache/http/message/BasicNameValuePair;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v4, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 37
    iget-object v0, p0, Lcom/facebook/orca/protocol/SendMessageMethod;->a:Lcom/facebook/orca/protocol/SendMessageParameterHelper;

    invoke-virtual {v0, v4, p1}, Lcom/facebook/orca/protocol/SendMessageParameterHelper;->a(Ljava/util/List;Lcom/facebook/orca/server/OutgoingMessage;)V

    .line 39
    const/4 v0, 0x0

    .line 40
    invoke-virtual {p1}, Lcom/facebook/orca/server/OutgoingMessage;->f()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 41
    iget-object v1, p0, Lcom/facebook/orca/protocol/SendMessageMethod;->a:Lcom/facebook/orca/protocol/SendMessageParameterHelper;

    invoke-virtual {v1, p1}, Lcom/facebook/orca/protocol/SendMessageParameterHelper;->b(Lcom/facebook/orca/server/OutgoingMessage;)Lcom/facebook/orca/protocol/ContentBody;

    move-result-object v1

    .line 43
    if-eqz v1, :cond_0

    .line 44
    new-instance v0, Lorg/apache/http/entity/mime/FormBodyPart;

    const-string v2, "image"

    invoke-direct {v0, v2, v1}, Lorg/apache/http/entity/mime/FormBodyPart;-><init>(Ljava/lang/String;Lorg/apache/http/entity/mime/content/ContentBody;)V

    move-object v5, v0

    .line 48
    :goto_0
    new-instance v0, Lcom/facebook/orca/protocol/ApiRequest;

    const-string v1, "sendMessage"

    const-string v2, "POST"

    const-string v3, ""

    invoke-direct/range {v0 .. v5}, Lcom/facebook/orca/protocol/ApiRequest;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lorg/apache/http/entity/mime/FormBodyPart;)V

    return-object v0

    :cond_0
    move-object v5, v0

    goto :goto_0
.end method

.method public bridge synthetic a(Ljava/lang/Object;)Lcom/facebook/orca/protocol/ApiRequest;
    .locals 1
    .parameter

    .prologue
    .line 20
    check-cast p1, Lcom/facebook/orca/server/OutgoingMessage;

    invoke-virtual {p0, p1}, Lcom/facebook/orca/protocol/SendMessageMethod;->a(Lcom/facebook/orca/server/OutgoingMessage;)Lcom/facebook/orca/protocol/ApiRequest;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic a(Ljava/lang/Object;Lcom/facebook/orca/protocol/ApiResponse;)Ljava/lang/Object;
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 20
    check-cast p1, Lcom/facebook/orca/server/OutgoingMessage;

    invoke-virtual {p0, p1, p2}, Lcom/facebook/orca/protocol/SendMessageMethod;->a(Lcom/facebook/orca/server/OutgoingMessage;Lcom/facebook/orca/protocol/ApiResponse;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public a(Lcom/facebook/orca/server/OutgoingMessage;Lcom/facebook/orca/protocol/ApiResponse;)Ljava/lang/String;
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 53
    invoke-virtual {p2}, Lcom/facebook/orca/protocol/ApiResponse;->a()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/facebook/orca/protocol/ApiResponseWrapper;->a(Ljava/lang/String;)Lcom/facebook/orca/protocol/ApiResponseWrapper;

    move-result-object v0

    .line 55
    invoke-virtual {v0}, Lcom/facebook/orca/protocol/ApiResponseWrapper;->a()Lorg/json/JSONObject;

    move-result-object v0

    .line 56
    const-string v1, "id"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method
